package com.coocaa.x.service.litecache;

import android.content.ComponentName;
import android.content.Context;
import android.os.IBinder;

import com.coocaa.x.service.XServiceManager.XServiceConnection;
import com.coocaa.x.service.litecache.aidl.ILiteCacheService;

public class LiteCacheConnecter extends XServiceConnection<ILiteCacheService> {

    private static final String ACTION = "com.coocaa.x.service.litecache2";
    private static final String CLASS_NAME = "com.coocaa.x.service.litecache.LiteCacheService";

    public static final ComponentName getComponentName(Context context) {
        return new ComponentName(context, CLASS_NAME);
    }

    public static final LiteCacheConnecter connecter = new LiteCacheConnecter();
    private ILiteCacheService service = null;

    public LiteCacheConnecter() {
        super(ACTION);
    }

    @Override
    public void onServiceConnected(ComponentName name, IBinder s) {
        service = (ILiteCacheService) ILiteCacheService.Stub.asInterface(s);
        super.onServiceConnected(name, s);
    }

    @Override
    public void onServiceDisconnected(ComponentName name) {
        service = null;
        super.onServiceDisconnected(name);
    }

    @Override
    protected ILiteCacheService _getService() {
        return service;
    }

}
